import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

const vcot = 'vcode_obtaining_time';
const store = new Vuex.Store({
  state: {
    vCode: null,
  },
  mutations: {
    getCode(state, payload) {
      state.vCode = payload;
      const startTime = Date.parse(new Date());
      localStorage.setItem(vcot, startTime);
    },
  },
  actions: {
    getCode(context, payload) {
      context.commit('getCode', payload);
    },
  },
});
export default store;
